package com.inno.life.infra.basic.service.impl;

import com.github.pagehelper.Page;

import com.inno.life.infra.basic.entity.PlannerScheduleManager;
import com.inno.life.infra.basic.mapper.PlannerScheduleManagerDao;
import com.inno.life.infra.basic.service.PlannerScheduleManagerService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/**
 * 日程管理表(PlannerScheduleManager)表服务实现类
 *
 * @author makejava
 * @since 2024-11-09 20:30:31
 */
@Service("plannerScheduleManagerServiceImpl")
public class PlannerScheduleManagerServiceImpl implements PlannerScheduleManagerService {
    @Resource
    private PlannerScheduleManagerDao plannerScheduleManagerDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PlannerScheduleManager queryById(Long id) {
        return this.plannerScheduleManagerDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param plannerScheduleManager 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerScheduleManager insert(PlannerScheduleManager plannerScheduleManager) {
        this.plannerScheduleManagerDao.insert(plannerScheduleManager);
        return plannerScheduleManager;
    }

    /**
     * 修改数据
     *
     * @param plannerScheduleManager 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerScheduleManager update(PlannerScheduleManager plannerScheduleManager) {
        this.plannerScheduleManagerDao.update(plannerScheduleManager);
        return this.queryById(plannerScheduleManager.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.plannerScheduleManagerDao.deleteById(id) > 0;
    }

    @Override
    public Page<PlannerScheduleManager> queryPage(PlannerScheduleManager plannerScheduleManager) {
        return this.plannerScheduleManagerDao.queryPage(plannerScheduleManager);
    }

    @Override
    public List<PlannerScheduleManager> getPendingReminders(Date nowDate) {
        return this.plannerScheduleManagerDao.getPendingReminders(nowDate);
    }
}
